package com.etc.user.controller;

import com.etc.entity.Province;
import com.etc.result.CodeMsg;
import com.etc.result.Result;
import com.etc.service.ProvinceService;
import com.etc.service.impl.ProvinceServinceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;

/**
 * 文件名:com.etc.user.controller.ProvinceController
 * 描述：中国省份信息控制层
 * 作者:吴仕泉
 * 时间:2019/5/26 15:05
 */
@Controller
@RequestMapping("province.action")
public class ProvinceController {

    @Autowired
    ProvinceServinceImpl provinceServince;

    //查询中国省份信息
    @RequestMapping("findAllProvince")
    @ResponseBody
    public Result<Province> findAllProvince(){
        System.out.println(11111);
       List<Province> provinces =  provinceServince.findProvinces();
       if(provinces == null){
           return Result.error(CodeMsg.REQUEST_ILLEGAL);
       }
        return Result.success(provinces);
    }
}
